/**
 * @file skoll.actions.content.cache.js
 * @author Alejandro Dario Simi
 * @date $Date: 2014-06-03 03:40:32 +0000 (Tue, 03 Jun 2014) $
 *
 * $Id: skoll.actions.content.cache.js 112 2014-06-03 03:40:32Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/skins/Skoll/js/skoll.actions.content.cache.js $
 */

Skoll.actions.content.cache = {
	//
	// Protected variables.
	//
	// Public methods.
	flush: function(id) {
		Skoll.tools.Loading.start(0);
		Skoll.tools.preventDefault();

		$.ajax({
			type: "POST",
			url: "?action=content:cache&group=" + GROUP_ID + "&format=json&nolayout" + Skoll.tools.extraUrlParams(),
			data: {
				id: id,
				task: "flush"
			},
			dataType: "json",
			success: function(data) {
				console.log(data);
				if (data.status) {
					Skoll.tools.reload();
				} else {
					alert(data.error_message);
					Skoll.tools.Loading.stop();
				}
			},
			error: function(data) {
				console.log(data);
				if (typeof data.responseText != "undefined") {
					console.log(data.responseText);
				}

				alert(wcomix.lang.translate("message_unknown_error"));
				Skoll.tools.Loading.stop();
			}
		});
	}
	//
	// Protected methods.
};

//$(document).ready(function() {
//	Skoll.actions.content.comic.addShortCuts();
//});
